export const beforeUpload = {
    methods: {
        beforeUpload(file) {
            const isJpgOrPng = file.type === 'image/jpeg'
                || file.type === 'image/png' || file.type === 'image/jpg' || file.type === 'image/gif';
            if (!isJpgOrPng) {
                this.$message.error('您只能上传图片!');
            }
            const isLt2M = file.size / 1024 / 1024 < 50;
            if (!isLt2M) {
                this.$message.error('图片不能大于1M');
            }
            return isJpgOrPng && isLt2M;
        },
    }
}